import service from "@/api/index.js";
import qs from "qs";

const orderApi = {
    //添加
    insert(orderVo){
        return service.post("/order",orderVo);
    },
    //删除
    delete(id){
        return service.delete(`/order/${id}`);
    },
    //修改
    update(order){
        return service.put("/order",order);
    },
    //分页搜索
    selectByPage(condition, pageNum, pageSize){
        condition.pageNum = pageNum;
        condition.pageSize = pageSize;
        return service.get("/order",{
            params: condition
        });
    },
    //根据id搜索
    selectById(id){
        return service.get(`/order/${id}`);
    },
    //支付
    pay(orderVo) {
        return service.post('/order/pay',orderVo)
    },
    selectByUserAll(pageNum, pageSize) {
        return service.get('/order/userAll',{
            params: {
                pageNum,
                pageSize
            }
        });
    }
}

export default orderApi;